package com.appoint.web.controller.buss;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.appoint.common.annotation.Log;
import com.appoint.common.core.controller.BaseController;
import com.appoint.common.core.domain.AjaxResult;
import com.appoint.common.enums.BusinessType;
import com.appoint.buss.domain.EpiparaChipInfo;
import com.appoint.buss.service.IEpiparaChipInfoService;
import com.appoint.common.utils.poi.ExcelUtil;
import com.appoint.common.core.page.TableDataInfo;

/**
 * chipInfoController
 *
 * @author appoint
 * @date 2023-02-18
 */
@RestController
@RequestMapping("/buss/chipInfo")
public class EpiparaChipInfoController extends BaseController
{
    @Autowired
    private IEpiparaChipInfoService epiparaChipInfoService;

    /**
     * 查询chipInfo列表
     */
    @PreAuthorize("@ss.hasPermi('buss:chipInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(EpiparaChipInfo epiparaChipInfo)
    {
        startPage();
        List<EpiparaChipInfo> list = epiparaChipInfoService.selectEpiparaChipInfoList(epiparaChipInfo);
        return getDataTable(list);
    }

    /**
     * 导出chipInfo列表
     */
    @PreAuthorize("@ss.hasPermi('buss:chipInfo:export')")
    @Log(title = "chipInfo", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, EpiparaChipInfo epiparaChipInfo)
    {
        List<EpiparaChipInfo> list = epiparaChipInfoService.selectEpiparaChipInfoList(epiparaChipInfo);
        ExcelUtil<EpiparaChipInfo> util = new ExcelUtil<EpiparaChipInfo>(EpiparaChipInfo.class);
        util.exportExcel(response, list, "chipInfo数据");
    }

    /**
     * 获取chipInfo详细信息
     */
    @PreAuthorize("@ss.hasPermi('buss:chipInfo:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(epiparaChipInfoService.selectEpiparaChipInfoById(id));
    }

    /**
     * 新增chipInfo
     */
    @PreAuthorize("@ss.hasPermi('buss:chipInfo:add')")
    @Log(title = "chipInfo", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody EpiparaChipInfo epiparaChipInfo)
    {
        return toAjax(epiparaChipInfoService.insertEpiparaChipInfo(epiparaChipInfo));
    }

    /**
     * 修改chipInfo
     */
    @PreAuthorize("@ss.hasPermi('buss:chipInfo:edit')")
    @Log(title = "chipInfo", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody EpiparaChipInfo epiparaChipInfo)
    {
        return toAjax(epiparaChipInfoService.updateEpiparaChipInfo(epiparaChipInfo));
    }

    /**
     * 删除chipInfo
     */
    @PreAuthorize("@ss.hasPermi('buss:chipInfo:remove')")
    @Log(title = "chipInfo", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(epiparaChipInfoService.deleteEpiparaChipInfoByIds(ids));
    }
}
